#ifndef CLIENT_H_
#define CLIENT_H_

//命令
typedef enum {
    //短命令
	CMD_TYPE_CD = 1,
	CMD_TYPE_LS,
	CMD_TYPE_PWD,
	CMD_TYPE_MKDIR,
	CMD_TYPE_RMDIR,
	CMD_TYPE_REMOVE,

    //长命令
	CMD_TYPE_PUTS,
    CMD_TYPE_PUTS_SYNC,
	CMD_TYPE_GETS,
    CMD_TYPE_GETS_SYNC,
	CMD_TYPE_TRANSFER_END, // 添加文件传输结束标记

    //登陆注册相关
    CMD_TYPE_LOGIN = 100,
    CMD_TYPE_REGISTER_NAME,
    CMD_TYPE_REGISTER_PASSWORD,

	
} CmdType;

//客户端状态


//命令TLV
typedef struct train_s
{
	CmdType taskType;
	int _length;
	char _data[1000];
} clientTLV;

//用来
typedef struct file_data
{
	int flag;//0,则是上传，1，下载
}FileData;
//连接
int tcpConnection(const char *ip, const char *port);

int recvn(int sockfd,void * buf,int length);

int sendn(int sockfd,const void * buf,int length);

//Epoll
int epollAdd(int epfd,int fd);
int epollDel(int epfd,int fd);

int parseCommand(const char *input, int len, clientTLV *pt);

int getCommandType(const char * str);

int putsCommand(clientTLV *pt);

int uploadFile(int sockfd, clientTLV *pt);

int downloadFile(int sockfd, clientTLV *pt);

#endif
